Loader.loadLib("ogreLib");

Holder.getObject("ogre", "Scene");
//Holder.getObject("head", "Entity");
//Holder.getObject("node", "Node");
//Holder.getObject("groundNode", "Node");
//Holder.getObject("plane", "Plane");
//Holder.getObject("light", "Light");
//Holder.getObject("camera", "Camera");
//Holder.getObject("camera2", "Camera");

////ogre.run()

//camera.xPos = 10000;
//camera.yPos = 22200;
//camera.zPos = 300;
//camera.xLookAt = 0;
//camera.yLookAt = 0;
//camera.zLookAt = -300;


//camera2.xPos = 100;
//camera2.yPos = 222;
//camera2.zPos = 300;
//camera2.xLookAt = 0;
//camera2.yLookAt = 0;
//camera2.zLookAt = -300;

//ogre.mainCamId = "camera";
//ogre.addObject(camera);
//ogre.addObject(camera2);

//ogre.aGreen = 0;
//ogre.aBlue = 0;
//ogre.aRed = 0;

//light.lightType = 2;
//light.difRed = 0.7;
//light.difGreen = 1;
//light.specBlue = 0;
//light.specRed = 1;
//light.difBlue = 0.2;
//light.yPos = 100;
//light.xPos = 100;

//light.dirX = -10;
//light.dirY = -10;
//light.dirz = 0;

//light.innerAng = 60;
//light.outerAng = 85;
//light.fallOff = 4;
//ogre.addObject(light)

////node.id = "node";
//node.parentNodeId = "root";
//groundNode.parentNodeId = "root";
////node.xPos = -75;
//ogre.addObject(node);
//ogre.addObject(groundNode);

////head.id = "Head";
//head.model = "ogrehead.mesh";
//head.nodeId = "node"
//head.castShadows = true;
//ogre.addObject(head);

//plane.xNormalPos = 0;
//plane.yNormalPos = 1;
//plane.zNormalPos = 0;

//plane.xUpPos = 1;
//plane.yUpPos = 0;
//plane.zUpPos = 0;

//plane.width = 1000;
//plane.height = 2000;
//plane.dist = 0;
//plane.castShadows = false;
//plane.nodeId = "groundNode";
//plane.materialName = "Examples/Grass";
//ogre.addObject(plane);

//groundNode.yPos = -40;

//var rCnt = 0;
//var dir = 0;
//var adir = 0;

//function move(elTime) {
//    //println("time = " + elTime);
//    rCnt = rCnt + elTime;
//   // if (rCnt >= 400) {
//     //   rCnt = 0;
//        //node.xPos = node.xPos + 1.2;
////        node.yPos = node.yPos + 0.001 * elTime;
//        node.xPos = node.xPos + 0.001 * elTime;
////    //}
//    if (dir == 0) {
//        node.xScale = node.xScale - 0.001 * elTime;
//        if (node.xScale <= 0.5) dir = 1;
//    } else {
//        node.xScale = node.xScale + 0.0001 * elTime;
//        if (node.xScale >= 1.5) dir = 0;
//        //ogre.stop();
//    }

//   // node.xAng = node.xAng + 0.01 * elTime;
//    //node.yAng = node.yAng + 0.01 * elTime;
//    node.zAng = node.zAng + 0.01 * elTime;

//    if (adir == 0) {
//        ogre.aRed = ogre.aRed + 0.001 * elTime;
//        if (ogre.aRed >= 1) adir = 1;
//    } else {
//        ogre.aRed = ogre.aRed - 0.001 * elTime;
//        if (ogre.aRed <= 0.1) adir = 0;
//    }

//    camera.yPos = camera.yPos - elTime;
//    camera.applyPos();
//    if (camera.yPos <= 100) {
//        ogre.mainCamId = "camera2";
//    }

////    ogre.aGreen = 0;
////    ogre.aBlue = 0;
////    ogre.aRed = 1;
////   light.yPos = light.yPos + 0.1 * elTime;
////    light.dirX = 10;
//}

//ogre.onFrameRendered.connect(move);
//ogre.onKeyPress.connect(keyp)

//        function keyp(key) {
//    if (key == 2) {
//        ogre.mainCamId = "camera";
//    }
//    if (key == 3) {
//        ogre.mainCamId = "camera2";
//    }
//}
